home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac-Source 1994 July
/
Mac-Source_July_1994.iso
/
C and C++
/
Libraries
/
Fab Libraries
/
Utils6.c
< prev
next >
Wrap
Text File
|
1994-01-03
|
2KB
|
94 lines
/*
Copyright © 1993,1994 by Fabrizio Oddone
••• ••• ••• ••• ••• ••• ••• ••• ••• •••
This source code is distributed as freeware: you can copy, exchange, modify this
code as you wish. You may include this code in any kind of application: freeware,
shareware, or commercial, provided that full credits are given.
You may not sell or distribute this code for profit.
*/
#pragma load "MacDump"
#include "Utils6.h"
typedef struct {
FSSpec destFile;
ScriptCode theScript;
} StdFileResult, *StdFileResultPtr;
#pragma segment Registration
OSErr FabFSpOpenDF(const FSSpec *spec,char permission,short *refNum)
{
long Gresp;
register Boolean flag = false;
if (Gestalt(gestaltFSAttr, &Gresp) == noErr)
if (Gresp & (1L << gestaltHasFSSpecCalls))
flag = true;
return (flag ?
FSpOpenDF(spec, permission, refNum) :
HOpen(spec->vRefNum, spec->parID, &spec->name, permission, refNum));
}
OSErr FabFSpCreate(const FSSpec *spec,OSType creator,OSType fileType, ScriptCode scrTag)
{
long Gresp;
register Boolean flag = false;
if (Gestalt(gestaltFSAttr, &Gresp) == noErr)
if (Gresp & (1L << gestaltHasFSSpecCalls))
flag = true;
return (flag ?
FSpCreate(spec, creator, fileType, scrTag) :
HCreate(spec->vRefNum, spec->parID, &spec->name, creator, fileType));
}
OSErr FabFSpDelete(const FSSpec *spec)
{
long Gresp;
register Boolean flag = false;
if (Gestalt(gestaltFSAttr, &Gresp) == noErr)
if (Gresp & (1L << gestaltHasFSSpecCalls))
flag = true;
return (flag ?
FSpDelete(spec) :
HDelete(spec->vRefNum, spec->parID, &spec->name));
}
void FabStandardPutFile(ConstStr255Param prompt,
ConstStr255Param defaultName,
StandardFileReply *reply)
{
Point mypt = {100, 100};
long Gresp;
register Boolean flag = false;
if (Gestalt(gestaltStandardFileAttr, &Gresp) == noErr)
if (Gresp & (1L << gestaltStandardFile58))
flag = true;
if (flag) {
StandardPutFile(prompt, defaultName, reply);
}
else {
SFReply myOldReply;
SFPutFile(mypt, prompt, defaultName, nil, &myOldReply);
reply->sfGood = myOldReply.good;
reply->sfReplacing = false;
reply->sfType = myOldReply.fType;
reply->sfFile.vRefNum = myOldReply.vRefNum;
reply->sfFile.parID = *(long *)CurDirStore;
(void) PLstrcpy(reply->sfFile.name, myOldReply.fName);
reply->sfScript = smCurrentScript;
}
}